package com.liaoban.app.adapter;

import android.support.annotation.Nullable;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.liaoban.app.R;
import com.liaoban.app.api.type.Img;
import com.liaoban.app.api.type.MyVideo;
import com.liaoban.app.helper.ImageHelper;
import com.liaoban.app.util.CommonUtils;

import java.util.List;

/**
 * Created by ybc on 2018/7/13 0013.
 * 我的视频
 */
public class MyVideoAdapter extends BaseQuickAdapter<MyVideo, BaseViewHolder> {

    public MyVideoAdapter(@Nullable List<MyVideo> data) {
        super(R.layout.item_my_video, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, MyVideo item) {
        if ((helper.getLayoutPosition() + 1) == getData().size()) { //最后一条
            helper.setGone(R.id.layout_img, false);
            helper.setGone(R.id.layout_add, true);
            helper.addOnClickListener(R.id.layout_add);
        } else {
            helper.setGone(R.id.layout_img, true);
            helper.setGone(R.id.layout_add, false);
            ImageView ivIcon = helper.getView(R.id.iv_icon);
            ImageHelper.load(ivIcon, CommonUtils.getFullPic(item.getImgSrc()));
            helper.addOnClickListener(R.id.ic_del);
        }
    }
}
